import {combineReducers} from 'redux';

import {reducer as loginReducer, reducer as languageReducer} from "../pages/login/store";
import {reducer as registerReducer} from "../pages/register/store";
import {reducer as chartReducer} from "../components/chart/store";
import {reducer as navigationReducer} from "../components/navigation/store";
import {reducer as dataReducer} from "../pages/main/store";
import {reducer as channelReducer} from "../pages/setting/channel/store";
import {reducer as protocolReducer} from "../pages/main/protocol/store";
import {reducer as experimentReducer} from "../pages/main/experiment/store";
import {reducer as plateReducer} from "../pages/main/plate/store";
import {reducer as runReducer} from "../pages/main/run/store";
import {reducer as dataManagerReducer} from "../pages/main/dataManager/store";
import {reducer as exportReducer} from "../pages/main/export/store";
import {reducer as quantificationReducer} from "../pages/main/analysis/components/quantification/store";
import {reducer as calculationReducer} from "../pages/main/calculation/components/quantification/store";
import {reducer as analysisReducer} from "../pages/main/analysis/store";
import {reducer as realtimeCurveReducer} from "../pages/main/run/components/realtimeCurve/store";
import {reducer as endPointReducer} from "../pages/main/analysis/components/endPoint/store";
import {reducer as geneSettingReducer} from "../pages/main/analysis/components/geneExpression/store";
import {reducer as allelicReducer} from "../pages/main/analysis/components/allelicDiscrimination/store";
import {reducer as quanlityControlReducer} from "../pages/main/analysis/components/quanlityControl/store";

//  loading组件加载
function loadingReducer(state = {isLoading: false}, action) {
  switch (action.type) {
    case "LOADING":
      return {...state, isLoading: action.payload};
    default:
      return state;
  }
}

const allReducer = combineReducers({
  loadingReducer,
  realtimeCurveReducer,
  languageReducer,
  loginReducer,
  chartReducer,
  navigationReducer,
  channelReducer,
  protocolReducer,
  experimentReducer,
  plateReducer,
  runReducer,
  quantificationReducer,
  calculationReducer,
  dataManagerReducer,
  registerReducer,
  exportReducer,
  analysisReducer,
  endPointReducer,
  geneSettingReducer,
  allelicReducer,
  quanlityControlReducer,
  dataReducer
});

export default allReducer;
